<?php

  class Login extends Window {
    public $login,$username,$password;
    

    function close() {
        $this->username->close();
        $this->password->close();        
        parent::close();
    }
    function actionPerformed($action) {
      if($action['component'] == $this->uuid && $action['action'] == "close") $this->close();
      if($action['component'] == $this->uuid . '_login') {
         $user = $this->username->getText();
         $pass = $this->password->getText();
         if($user == "benedykt" && $pass == "dupa") $this->close();
      }
      
    }
    function __construct($uuid) {
      parent::__construct($uuid);

      $this->setBounds(30,20,300,250); 
      
      $this->username = new TextField($uuid . "_username","","username:");
      $this->username->setLocation(50,50);
      $this->add($this->username);  
      
      $this->password = new TextField($uuid . "_password","","password:");
      $this->password->setType("password");
      $this->password->setLocation(100,50);
      $this->add($this->password);
      
      $this->login = new Button($uuid . "_login","Log In");
      $this->login->setLocation(160,50);
      $this->add($this->login);
      
    }      
  }
?>
